package cn.ciee.f4.orchard.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class LogDbHelper extends SQLiteOpenHelper {
	private static final String DATABASE_NAME = "orchard_system.db";
	private static final int DATABASE_VERSION = 1;

	public LogDbHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		db.execSQL("CREATE TABLE operationlog"
				+ " (_id  INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"+
				"action  TEXT NOT NULL, "+
				"actiondetails  TEXT NOT NULL,"+
				"operationtime  TEXT NOT NULL)");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		// TODO Auto-generated method stub
		String sql = " DROP TABLE IF EXISTS operationlog";
		db.execSQL(sql);
		onCreate(db);
	}
}
